package com.thunbu.thunbu_meeting_system.dialog

import android.app.Activity
import android.opengl.Visibility
import android.widget.FrameLayout
import android.widget.TextView
import com.lxj.xpopup.core.BasePopupView

import com.lxj.xpopup.core.BottomPopupView

import com.thunbu.thunbu_meeting_system.R
import com.thunbu.thunbu_meeting_system.activity.InventoryActivity
import com.thunbu.thunbu_meeting_system.activity.ScanRegisterActivity
import com.thunbu.thunbu_meeting_system.bean.AssetModel
import com.thunbu.thunbu_meeting_system.gotoActivity
import kotlinx.android.synthetic.main.dialog_operate.view.*

class ScanPop(val activity: Activity,val assetModel: AssetModel): BasePopupView(activity) {
    override fun getPopupLayoutId(): Int = R.layout.dialog_scan_result




    override fun onCreate() {
        super.onCreate()

        val fr_parent = findViewById<FrameLayout>(R.id.fr_parent)
        val tv_value1 = findViewById<TextView>(R.id.tv_value1)
        val tv_value2 = findViewById<TextView>(R.id.tv_value2)
        val tv_value3 = findViewById<TextView>(R.id.tv_value3)
        val tv_value4 = findViewById<TextView>(R.id.tv_value4)
        fr_parent.setOnClickListener {
            dismiss()
        }
        if(assetModel.assetStatus ==1){
            tv_value1.visibility = VISIBLE
            tv_value1.text="资产:".plus(assetModel.zichanmc).plus(" ").plus("已盘存")
            tv_value2.visibility=VISIBLE
            tv_value2.text=assetModel.gs1.plus(" ").plus("、").plus(assetModel.zichanflmc)
                .plus("、").plus(assetModel.guobiaodalei)

        }else if(assetModel.assetStatus ==2){
            tv_value1.visibility = VISIBLE
            tv_value1.text="资产:".plus(assetModel.zichanmc).plus(" ").plus("盘亏")
            tv_value2.visibility=VISIBLE
            tv_value2.text=assetModel.gs1.plus(" ").plus("、").plus(assetModel.zichanflmc)
                .plus("、").plus(assetModel.guobiaodalei)
        }else{
            tv_value3.visibility = VISIBLE
            tv_value3.text="资产:".plus(assetModel.zichanmc).plus(" ").plus("未登记")
            tv_value4.visibility = VISIBLE
        }

        tv_value4.setOnClickListener {
            activity.gotoActivity<ScanRegisterActivity>()
        }

    }


}